package com.example.child_protection.controller;

import com.example.child_protection.dto.base.BaseResponseDTO;
import com.example.child_protection.dto.request.SimpleIdRequestDTO;
import com.example.child_protection.dto.request.add.UserInsertRequestDTO;
import com.example.child_protection.dto.request.find.LoginRequestDTO;
import com.example.child_protection.dto.request.update.UserUpdateRequestDTO;
import com.example.child_protection.service.LoginService;
import com.example.child_protection.service.UserManageService;
import com.example.child_protection.util.ContentType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录控制层
 * @date 2018-11-2
 * @author Biz
 */
@RestController
@RequestMapping("/")
@Api(value = "/api-login", description = "登录控制层")
public class LoginController extends BaseController {

    @Autowired
    public LoginService loginService;

    @ApiOperation(value ="登录", httpMethod = "POST",response = BaseResponseDTO.class )
    @RequestMapping(value = "/login", method = RequestMethod.POST, produces = {ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
    public BaseResponseDTO login(LoginRequestDTO requestDTO)throws Exception{
        BaseResponseDTO responseDTO = loginService.login(requestDTO);
        return responseDTO;
    }

}
